<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>pg_rewrite</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="SECT1">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="catalog-pg-proc.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="catalogs.html">快退</a></td><td width="60%" align="center" valign="bottom">章43. 系统表</td><td width="10%" align="right" valign="top"><a href="catalogs.html">快进</a></td><td width="10%" align="right" valign="top"><a href="catalog-pg-shdepend.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<div class="SECT1"><h1 class="SECT1"><a name="CATALOG-PG-REWRITE">43.28. <tt class="STRUCTNAME">pg_rewrite</tt></a></h1><a name="AEN64501"></a>
<p><tt class="STRUCTNAME">pg_rewrite</tt> 存储为表和视图定义的重写规则。</p>
<div class="TABLE"><a name="AEN64505"></a>
<p><b>表43-28. <tt class="STRUCTNAME">pg_rewrite</tt> 字段</b></p>
<table border="1" class="CALSTABLE"><col><col><col><col>
<thead>
<tr><th>名字</th><th>类型</th><th>引用</th><th>描述</th></tr>
</thead>
<tbody>
<tr><td><tt class="STRUCTFIELD">rulename</tt></td><td><tt class="TYPE">name</tt></td><td>&nbsp;</td><td>规则名称</td></tr>
<tr><td><tt class="STRUCTFIELD">ev_class</tt></td><td><tt class="TYPE">oid</tt></td><td><tt class="LITERAL"><a href="catalog-pg-class.html"><tt class="STRUCTNAME">pg_class</tt></a>.oid</tt></td><td>使用这条规则的表名称</td></tr>
<tr><td><tt class="STRUCTFIELD">ev_attr</tt></td><td><tt class="TYPE">int2</tt></td><td>&nbsp;</td><td>这条规则适用的字段(目前总是为零，表示整个表)</td></tr>
<tr><td><tt class="STRUCTFIELD">ev_type</tt></td><td><tt class="TYPE">char</tt></td><td>&nbsp;</td><td>规则适用的事件类型： 1 = <tt class="COMMAND">SELECT</tt>, 2 = <tt class="COMMAND">UPDATE</tt>, 3 = <tt class="COMMAND">INSERT</tt>, 4 = <tt class="COMMAND">DELETE</tt></td></tr>
<tr><td><tt class="STRUCTFIELD">is_instead</tt></td><td><tt class="TYPE">bool</tt></td><td>&nbsp;</td><td>如果该规则是 <tt class="LITERAL">INSTEAD</tt> 规则，那么为真</td></tr>
<tr><td><tt class="STRUCTFIELD">ev_qual</tt></td><td><tt class="TYPE">text</tt></td><td>&nbsp;</td><td>规则的资格条件的表达式树(以 <code class="FUNCTION">nodeToString()</code> 形式存在)</td></tr>
<tr><td><tt class="STRUCTFIELD">ev_action</tt></td><td><tt class="TYPE">text</tt></td><td>&nbsp;</td><td>规则动作的查询树(以 <code class="FUNCTION">nodeToString()</code> 形式存在)</td></tr>
</tbody>
</table>
</div>
<div class="NOTE">
<blockquote class="NOTE">
<p><b>【注意】</b>如果一个表在这个系统表里有任何规则存在，那么 <tt class="LITERAL">pg_class.relhasrules</tt> 必须为真。</p>
</blockquote>
</div>
</div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="catalog-pg-proc.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="catalog-pg-shdepend.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top"><tt class="STRUCTNAME">pg_proc</tt></td><td width="34%" align="center" valign="top"><a href="catalogs.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top"><tt class="STRUCTNAME">pg_shdepend</tt></td></tr>
</table>
</div>
</body></html>